package org.ilead.iserve.model;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.persistence.Entity;

/**
 * 站内信之系统信件
 * SystemMessage entity. @author MyEclipse Persistence Tools
 */

@Entity
public class SystemMessage implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer id;
	private String title;
	private String content;
	private Date sendTime;
	
	/**
	 * 标识信件状态，0为未读，1为已读, -1为已删除
	 */
	private int state;
	
	private String formatTime;

	// Constructors

	/** default constructor */
	public SystemMessage() {
	}

	/** full constructor */
	public SystemMessage(String title, String content, Date sendTime) {
		this.title = title;
		this.content = content;
		this.sendTime = sendTime;
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getSendTime() {
		return this.sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

	public int getState() {
		return state;
	}

	public void setState(int state) {
		this.state = state;
	}
	
	public String getFormatTime(){
		if(formatTime == null || "".equals(formatTime)){
			SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd");
			formatTime = format.format(sendTime);
		}
		return formatTime;
	}

}